//
//  RMTabBarController.m
//  rmplanner
//
//  Created by cs321ga3 on 3/10/12.
//  Copyright (c) 2012 BOSS Systems. All rights reserved.
//

#import "RMTabBarController.h"
#import "RMFlipViewController.h"
#import "RMFirstViewController.h"
#import "RMSecondViewController.h"

@interface RMTabBarController ()

@end

@implementation RMTabBarController

#pragma mark UIViewController functions

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
	self.delegate = self;
	self.navigationItem.title = @"Today's Meals";
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
		return (interfaceOrientation == UIInterfaceOrientationPortrait);
	else
		return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

#pragma mark Interface Builder Actions

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
		if ([viewController.navigationItem.title isEqualToString:@"Today's Meals"])
		{
			self.navigationItem.title = @"Today's Meals";
			//[viewController loadView];
		}
		else if ([viewController.navigationItem.title isEqualToString:@"Future Meals"])
		{
			self.navigationItem.title = @"Future Meals";
			//[viewController loadView];
		}
		else
			self.navigationItem.title = @"Feedback";
}

#pragma mark Segue functions

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
	if ([[segue identifier] isEqualToString:@"Settings"])
	{
		[((RMFlipViewController *)[segue destinationViewController]).tableView reloadData];
	}
}

@end
